<template>
	<view class="bbs" @click="hotNews">
		<view class="userinfo">
			<image class="info-icon" :src="dataSource.avatar"></image>
			<view class="info">
				<text class="name">{{dataSource.nickname}}</text>
				<text class="date">{{dataSource.add_time}}</text>
			</view>
		</view>
		<text class="mes">{{dataSource.title}}</text>
		<view class="potho-view">
			<image class="potho" :src="item" v-for="(item,index) in dataSource.images_urls" :key="index" @click.stop="lookBigPotho(item)"></image>
		</view>
		<view class="bottom-view">
			<view class="row-center">
				<image class="number_icon" src="../../../static/images/look_number.png"></image>
				<text class="number">{{dataSource.view_count}}</text>
			</view>
			<view style="display: flex;align-items: center;">
				<view class="row-center" style="margin-right: 28upx;">
					<image class="number_icon" src="../../../static/images/pj_number.png"></image>
					<text class="number">{{dataSource.comment_count}}</text>
				</view>
				<view class="row-center">
					<image class="number_icon" src="../../../static/images/like_number.png"></image>
					<text class="number">{{dataSource.praise_count}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			dataSource: {
				type: Object,
				default: () => {}
			}
		},
		data() {
			return {

			}
		},
		methods: {
			hotNews() {
				uni.navigateTo({
					url: '/pages/hotNewDetails/index?type=2&id=' + this.dataSource.id
				})
			},
			lookBigPotho(e){//查看大图
				uni.previewImage({
					current:e,
					urls:this.dataSource.images_urls,
					success: function(res) {},
					fail: function(res) {
						console.log(res)
					},
					complete: function(res) {},
				})
			},
		}
	}
</script>

<style lang="scss">
	.bbs {
		width: 690upx;
		background-color: #fff;
		border-radius: 30upx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		margin-bottom: 20upx;

		.userinfo {
			display: flex;
			align-items: center;
			padding: 20upx;
			box-sizing: border-box;

			.info-icon {
				width: 112upx;
				height: 112upx;
				margin-right: 20upx;
				border-radius: 50%;
			}

			.info {
				display: flex;
				flex-direction: column;
				flex: 1;
				justify-content: center;

				.date {
					color: #999;
					font-size: 24upx;
					margin-top: 16upx;
				}

				.name {
					color: #333;
					font-size: 28upx;
					font-weight: 500;
				}
			}
		}

		.mes {
			color: #333;
			font-size: 28upx;
			margin: 0 20upx;
			line-height: 40rpx;
			text-overflow: -o-ellipsis-lastline;
			overflow: hidden;
			text-overflow: ellipsis;
			display: -webkit-box;
			-webkit-line-clamp: 2;
			line-clamp: 2;
			-webkit-box-orient: vertical;
		}

		.potho-view {
			width: 100%;
			padding: 0 20upx;
			box-sizing: border-box;
			display: flex;
			flex-wrap: wrap;
			margin-top: 20upx;

			.potho {
				width: 200upx;
				height: 200upx;
				// background-color: red;
				margin-right: 25upx;
				margin-bottom: 20upx;
				border-radius: 8upx;
			}

			.potho:nth-of-type(3n) {
				margin-right: 0;
			}
		}
	}

	.bottom-view {
		width: 100%;
		height: 96upx;
		padding: 0 20upx;
		position: relative;
		// border-top: 1px solid #F8F8F8;
		box-sizing: border-box;
		// margin-bottom: 20upx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.row-center {
			display: flex;
			align-items: center;
			color: #999;
			font-size: 20upx;

			.number_icon {
				width: 56upx;
				height: 56upx;
			}
		}
	}

	.bottom-view:after {
		position: absolute;
		content: '';
		top: 0;
		left: 20upx;
		right: 20upx;
		height: 1px;
		background-color: #F8F8F8;
	}
</style>
